<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>canvas粒子烟雾</title>
</head>
<body>
  <input id="inp" type="text" />
  <span id="txt">{{test}}</span>
  <script>
    var obj = {};
    Object.defineProperty(obj,'test',{
      set(val) {
        document.querySelector('#inp').value = val;
        document.querySelector('#txt').innerHTML = val;
      }
    })
    document.querySelector('#inp').addEventListener('input', (e) => {
      obj.test = e.target.value;
    }) 
  </script>
</body>
</html>